<template>
  <div>
    <el-input placeholder="请输入姓名" style="width: 200px; margin: 5px" suffix-icon="el-icon-search"
              v-model="xm"></el-input>
    <el-input placeholder="请输入劳动合同号" style="width: 200px; margin: 5px" suffix-icon="el-icon-search"
              v-model.trim="ldhth"></el-input>
    <el-button type="primary" style="margin: 5px" @click="search">搜索</el-button>
    <div>
      <el-button type="primary" style="margin: 5px">新增 <i class="el-icon-circle-plus"></i></el-button>
      <el-button type="danger" style="margin: 5px">批量删除 <i class="el-icon-remove"></i></el-button>
      <el-button type="primary" style="margin: 5px">导入 <i class="el-icon-download"></i></el-button>
      <el-button type="primary" style="margin: 5px">导出 <i class="el-icon-upload"></i></el-button>
    </div>
    <el-table :data="tableData" stripe border style="margin: 5px">
      <el-table-column prop="id" label="ID" width="200">
      </el-table-column>
      <el-table-column prop="dwmc" label="单位名称" width="200">
      </el-table-column>
      <el-table-column prop="ldhth" label="劳动合同号" width="140">
      </el-table-column>
      <el-table-column prop="xm" label="姓名" width="140">
      </el-table-column>
      <el-table-column prop="gw" label="岗位" width="300">
      </el-table-column>
      <el-table-column>
        <template slot-scope="scope">
          <el-button type="primary" style="margin: 0 5px">编辑<i class="el-icon-edit"></i></el-button>
          <el-button type="danger" style="margin: 0 5px">删除<i class="el-icon-remove"></i></el-button>
        </template>
      </el-table-column>
    </el-table>
    <div class="block" style="margin: 5px">

      <el-pagination
          @size-change="handleSizeChange"
          @current-change="handleCurrentChange"
          :current-page="currentPage"
          :page-sizes="[10, 20, 50, 100]"
          :page-size="pageSize"
          layout="total, sizes, prev, pager, next, jumper"
          :total="this.total">
      </el-pagination>
    </div>
  </div>

</template>

<script>
import service from "@/utils/request";

export default {
  data() {

    return {
      tableData: [],
      currentPage: 1,
      pageSize: 10,
      total: 0,
      xm: null,
      ldhth: null
    }
  },
  created() {
    this.load();

  },
  methods: {
    load() {
      service.get("/ryxx", {
        params: {
          currentPage: this.currentPage,
          pageSize: this.pageSize,
          xm: this.xm,
          ldhth: this.ldhth

        }
      }).then(response => {
        this.tableData = response.data.records;
        this.total = response.data.total;
      })

    },
    handleSizeChange(val) {
      this.pageSize = val;
      this.load()

    },
    handleCurrentChange(val) {
      this.currentPage = val
      this.load()
    },
    search() {
      this.currentPage = 1
      this.load();
    }

  }
}

</script>


<style scoped>

</style>